//删除
let { love } = require("./love_schema.js");
let { system } = require("../system_msg/system_schema.js");
module.exports = {
    delLove: function (req, res, err) {
        let user = req.query.user || req.query.sendUser;
        let toUser = req.query.toUser || req.query.addressee;
        console.log(user, toUser, 97845);
        love.deleteOne({ user, toUser }).then((data) => {
            if (req.query.status == 5) {
                let title = "系统消息";
                let content = `你对用户${req.query.toUser}的结缘申请已撤回！`;
                let sendUser = "情缘工作组";
                let addressee = req.query.user;
                let core = 1;
                let reply = "no";
                let createTime = req.query.createTime;
                system.create({ sendUser, addressee, core, title, content, reply, createTime }).then((emailData) => {
                    res.send(true);
                })
            } else if (req.query.status == 4) {
                let title = "系统消息";
                let content = `你对用户${req.query.addressee}的结缘申请已被对方拒绝！`;
                let sendUser = "情缘工作组";
                let addressee = req.query.sendUser;
                let core = 1;
                let reply = "no";
                let createTime = req.query.createTime;
                system.create({ sendUser, addressee, core, title, content, reply, createTime }).then((emailData) => {
                    res.send(true);
                })
            }

        })
    }
}